document.getElementById("save").onclick=function(){
	var data={}
	data.level=$("#level").val()
	data.free=$("#free").val()
	console.log(data)
	
	if(data.level===""){
		showErrorInfo("请填写累计积分额！")
		return false;
	}
	if(data.free===""){
		showErrorInfo("请填写赠送额！")
		return false;
	}
	data=JSON.stringify(data)
	$.ajax({
		"url":"/consumption_level/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"data":{"data":data},
		"type":getQ().type,
		"success":function(data){
			if(responseCheck(data)){
				alert("操作成功!")
				window.opener.location.reload()
				window.close()
			}
		}
	})
}
function parseData(){
	if (getQ().type==="PUT"){
		
		var data=getQ().data
		data=JSON.parse(data)
		$("#level").val(data.level).attr("readonly",true)
		$("#free").val(data.free)
	}
}
parseData()
document.getElementById("level").focus()
